package P2100;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * @author: zhouyang
 * @descrpition:
 * @time: 2019-10-08 14:49
 */
public class P2141_珠心算测验 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int nums = scanner.nextInt();
        Map<Integer,Integer> map = new HashMap<>();
        int[] vals = new int[nums];
        while(nums-- > 0){
            int now = scanner.nextInt();
            vals[nums] = now;
            map.put(now,map.getOrDefault(now,0)+1);
        }
        scanner.close();
        Arrays.sort(vals);
        int res = 0;
        for(int i=2;i<vals.length;++i){
            for(int j=i-1;j>0;--j){
                int left = vals[i]-vals[j];
                if(left >= vals[j]) break;
                if(map.containsKey(left)){
                        ++res;
                        break;
                }
            }
        }
        System.out.println(res);
    }
}
